package ShuZu;
import java.util.Arrays;
public class Array_GDBC_demo01 {
    /**本类用于复习数组的相关内容*/
        public static void main(String[] args) {
            int[] a ={1,2,3,4,5};
            int[] a1 = new int[]{1,2,3,4,5};
            int[] a3 = new int[5];

            a3[0] = 1;
            a3[1] = 2;
            a3[2] = 3;
            a3[3] = 4;
            a3[4] = 5;


            System.out.println(Arrays.toString(a3));
            for (int i= 0;i< a3.length;i++){
                a3[i] = i;

            }
            System.out.println(Arrays.toString(a3));

            for (int i = 0;i<a.length;i++){
                System.out.println(i);//打印下标
                System.out.println(a[i]);//打印数组元素


                a1 = Arrays.copyOf(a1,8);//数组的扩容
                System.out.println(Arrays.toString(a1));//数组的打印

                a3 = Arrays.copyOf(a3,4);//数组的缩容
                System.out.println(Arrays.toString(a3));

            }
            /**本类用于练习Arrays排序方法*/

               int[]b = {33,22,55,44,88};
               Arrays.sort(b);
               System.out.println(Arrays.toString(b));


        }
}
